package com.yn.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 车辆状态枚举
 */
@AllArgsConstructor
@Getter
public enum CarStatusEnum {

	FREE(0, "空闲"),

	OPERATION(1, "运营中"),

	RESTING(2, "休息中"),

	STOP_OPERATION(3, "已停运"),

	;

	private Integer code;

	private String name;

	public static CarStatusEnum getByCode(Integer code) {
		if(null == code) {
			return null;
		}
		for(CarStatusEnum carStatusEnum : CarStatusEnum.values()) {
			if(carStatusEnum.getCode() == code) {
				return carStatusEnum;
			}
		}
		return null;
	}

}
